package com.soft.bams.utlis;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author yangwenqi
 * @decs TODO
 * @date 2025/6/25
 */
public class ThreadPoolUtils {

    private ThreadPoolExecutor pool;

    public ThreadPoolUtils(int maxPoolSize , int queueSize){
        pool = new ThreadPoolExecutor(
                20 , maxPoolSize ,
                60 , TimeUnit.SECONDS,
                new LinkedBlockingQueue<Runnable>(queueSize),
                new ThreadPoolExecutor.AbortPolicy());
    }

    public void exec(Runnable runnable){
        pool.submit(runnable);
    }

}
